﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Electronic_work_order.Interfacess.OA_Expense_reimbursement_LEI;
using Electronic_work_order.Model;

namespace Electronic_work_order.Controllers
{
    [ApiController]
    public class OA_Expense_LEIController : ControllerBase
    {
        private readonly IExpense_reimbursement _Reimbursement;

        public OA_Expense_LEIController(IExpense_reimbursement reimbursement)
        {
            _Reimbursement = reimbursement;
        }

        [HttpPost]
        [Route("[controller]/AddER")]
        public int AddER(Expense_reimbursement er)
        {
            if (_Reimbursement.Addexpense_Reimbursement(er)>0)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }

        [HttpGet]
        [Route("[controller]/GetER_Types")]
        public IEnumerable<Expense_reimbursement_Type> GetER_Types() {
            return _Reimbursement.Getexpense_Reimbursement_Types();
        }
    }
}
